home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_pow_sequencer_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
5KB
|
192 lines
# Jedi Knight MOTHS Cog Script
#
# POW_SEQUENCER.COG
#
# POWERUP Script - Sequencer
#
# [YB, CYW, SRS]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
template explode=+large_exp local
thing powerup local
thing player local
thing sender local
int bin=8 local
sound pickupsnd=thrmlpu2.wav local
sound respawnsnd=Activate01.wav local
flex amount local
int bin_contents=0 local
int autopickup=0 local
int autosel=-1 local
int damage local
message created
message damaged
message touched
message taken
message respawn
message timer
end
# ========================================================================================
code
created:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
Return;
# ........................................................................................
touched:
if (GetWeaponBin(bin) == -1)
return;
player = GetSourceRef();
if (GetThingType(player) == 10) // Can only be taken by players.
{
amount = GetInv(player, GetWeaponBin(bin));
if (IsMulti() || (amount < GetInvMax(player, GetWeaponBin(bin))))
{
TakeItem(GetSenderRef(), -1);
call taken;
}
}
Return;
# ........................................................................................
damaged:
sender = GetSenderRef();
// only take damage 33% of the time
if(rand() < 0.33)
return;
// If it's already dead, don't allow any more damage.
if (!GetThingUserData (sender))
return;
damage = GetParam (0);
// see if this will cause the explosion
if (GetThingUserData (sender) <= damage)
{
SetThingUserData(sender, 0);
// timer for base explosion
SetTimerEx ((Rand () * 0.5), sender, 1, 0);
}
else
{
SetThingUserData(sender, GetThingUserData (sender) - damage);
}
ReturnEx (0);
return;
# ........................................................................................
taken:
if (GetWeaponBin(bin) == -1)
return;
powerup = GetSenderRef();
// // If the object has been destroyed, don't award it to the player.
// if (!GetThingUserData (powerup))
// return;
player = GetSourceRef();
// Print("Sequencer Charges");
jkPrintUNIString(player, GetWeaponBin(bin));
// Do effects.
PlaySoundLocal(pickupsnd, 1, 0, 0);
AddDynamicTint(player, 0.0, 0.0, 0.2);
// store the old bin contents
bin_contents = GetInv(player, GetWeaponBin(bin));
// Increment powerup amount.
ChangeInv(player, GetWeaponBin(bin), 5.0);
// For both uses.
if (!GetInv(player, GetWeaponBin(bin+10)))
SetInv(player, GetWeaponBin(bin+10), 1.0);
// Check for Auto Pickup
autopickup = GetAutoPickup();
if((autopickup & 1) && !(autopickup & 2)) // DANGEROUS
{
if(!bin_contents)
{
if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, GetWeaponBin(bin), 0))))
{
if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
{
// Don't switch weapons if we are in manual mode already!
if (GetCurWeapon(player) != (bin + 10))
SelectWeapon(player, GetWeaponBin(bin));
Return;
}
}
}
}
// Check for Auto Reload
if(GetAutoReload() & 1)
{
if(!bin_contents)
{
if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
{
// Try to autoselect and see if the best weapon is the sequencer
autosel = AutoSelectWeapon(player, 2);
if((autosel % 10) == 8)
// Don't switch weapons if we are in manual mode already!
if (GetCurWeapon(player) != (bin + 10))
SelectWeapon(player, autosel);
}
}
}
return;
# ........................................................................................
respawn:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
return;
# ........................................................................................
timer:
sender = GetSenderId ();
powerup = CreateThingNR(explode, sender);
// Since the user data is 0, the player won't actually be awarded this powerup.
TakeItem (sender, -1);
return;
end